// Instructor类
public class Instructor {
    private List<Subject> subjects = new ArrayList<>();

    public void addSubject(Subject subject) {
        if (subjects.size() < 3) {
            subjects.add(subject);
        } else {
            System.out.println("每位教师最多只能教授三门课程");
        }
    }

    public List<Subject> getSubjects() {
        return subjects;
    }
}
